<?php
include_once('common/header.php');
if($AppUI->id <= 0 || (isset($_SESSION['education']) && (($_SESSION['education']&1<<2) == 0))) {
	$this->_redirect(HOST_BACKEND);
}
$intType			= $objRequest->getParam('type', EDUCATION_TYPE);
$intEducateId 		= $objRequest->getParam('educateid', 0);
$objEducation		= new Education();
$objSlideshow		= new Slideshow();
$objCategory		= new Category();
$objCommon			= new Ecore_Common();
$arrRow				= $objEducation->get($intEducateId);
$arrEspec			= $objEducation->getAllEducationSpec($intEducateId);
$arrSub				= null;
$arrSpec			= null;
$arrCateS			= null;
if(isset($arrEspec)) {
	foreach($arrEspec as $val) {
		$arrCateS[$val['categoryid']] = $val['categoryid'];
	}
}
if(isset($_SESSION['EDUCATION_POST']['pprovince'])) $intProvinceId = $_SESSION['EDUCATION_POST']['pprovince'];
else $intProvinceId = $arrRow['province'];
$intCategoryId				= isset($_SESSION['EDUCATION_POST']['pcategoryid']) ? $_SESSION['EDUCATION_POST']['pcategoryid'] : $arrRow['categoryid'];
$this->view->row			= $arrRow;
$this->view->arrCategory	= $objCategory->getParent($intType);
$this->view->arrSub			= $objCategory->getChild($intCategoryId);
$this->view->arrSpec		= $objCategory->getParent(EDUCATION_SPEC_TYPE);
$this->view->arrCateS		= $arrCateS;
$this->view->back			= isset($_SESSION[SESSION_BACKURL]) ? $_SESSION[SESSION_BACKURL] : HOST_BACKEND;
$this->view->arrAlbum		= $objSlideshow->getAlbumForCombo($intType);
$this->view->arrProvince	= $objCommon->getProvince();
$this->view->arrDistrict	= $objCommon->getDistrict($intProvinceId);
if(isset($_SESSION['EDUCATION_POST']['ptbfeature'])) {
	$strJson	= str_replace('\\','',$_SESSION['EDUCATION_POST']['ptbfeature']);	
	$this->view->arrFeatures = json_decode($strJson);
}elseif(isset($arrRow['features'])) {
	$strJson	= str_replace('\\','',$arrRow['features']);
	$this->view->arrFeatures = json_decode($strJson);
}